<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!--head部分-->
<head th:include="layout :: htmlhead" th:with="title='后台管理'">
</head>
<body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <!--头-->
        <div th:replace="fragments/head :: header"></div>
        <div class="layui-body">
        
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
  <legend>生产计划</legend>
</fieldset>

<div class="layui-form">
  <table class="layui-table">
    <colgroup>
      <col width="150">
      <col width="200">
      <col>
    </colgroup>
    <thead>
      <tr>
        <th>参数名</th>
        <th>参数值</th>
      </tr> 
    </thead>
    <tbody>
      <tr>
        <td>订单编号</td>
        <td>1111</td>
      </tr>
      <tr>
        <td>产品代码</td>
        <td>MJ7115</td>
      </tr>
      <tr>
        <td>产品名称</td>
        <td>简式磨床</td>
      </tr>
      <tr>
        <td>要求产量</td>
        <td>10</td>
      </tr>
      <tr>
        <td>计划开始时间</td>
        <td>2018年9月3日</td>
      </tr>
      <tr>
        <td>计划完成时间</td>
        <td>2018年9月3日</td>
      </tr>
      <tr>
        <td>实际时间</td>
        <td>2018年9月3日</td>
      </tr>
      <tr>
        <td>库存满足情况</td>
        <td><i class="layui-icon layui-icon-rate layui-bg-red">无法满足</i></td>
      </tr>
      <tr>
        <td>最快满足时间</td>
        <td>2018年10月3日</td>
      </tr>
    </tbody>
  </table>
</div>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
  <legend>生产计划中零件情况</legend>
</fieldset>

        <div class="demoTable">
            &nbsp;&nbsp;<button class="layui-btn" onclick="backList()">返回列表</button>
            &nbsp;&nbsp;<button class="layui-btn" onclick="export()">导出零件情况</button>
        </div>
<table class="layui-table" lay-data="{url:'/getPurchaseResult',page:true, id:'test3'}" lay-filter="test3">
  <thead>
    <tr>
<th lay-data="{field:'cinvcode', width:100, edit: 'text'}">存货编码</th>
<th lay-data="{field:'cinvaddcode', width:100, edit: 'text'}">存货代码</th>
<th lay-data="{field:'cinvname', width:100, edit: 'text'}">存货名称</th>
<th lay-data="{field:'cinvstd', width:100, edit: 'text'}">存货型号</th>
<th lay-data="{field:'fquantity', width:100, edit: 'text'}">要求产量</th>
<th lay-data="{field:'stockquantity', width:100, edit: 'text'}">库存量</th>
<th lay-data="{field:'purchasequantity', width:100, edit: 'text'}">预计采购量</th>
<th lay-data="{field:'quantity', width:100, edit: 'text', sort: true}">可用数量</th>
<th lay-data="{ field: 'cancomplete', width: 180, align: 'center', templet: '#titleTpl'}">库存满足</th>
    </tr>
  </thead>
</table>
            
</body>
<script type="text/html" id="titleTpl">
  {{#  if(d.fquantity > d.stockquantity+d.purchasequantity){ }}
    <i class="layui-icon layui-icon-rate layui-bg-red">需补充采购</i>
  {{#  } else if (d.fquantity <= d.stockquantity+d.purchasequantity && d.fquantity > d.stockquantity){ }}
    <i class="layui-icon layui-icon-rate-half layui-bg-orange">采购可满足</i>
  {{#  } else { }}
    <i class="layui-icon layui-icon-rate-solid layui-bg-green">库存可满足</i>
  {{#  } }}
</script>
<script type="text/javascript">
//<![CDATA[
layui.use(['laydate','table'], function(){
  var laydate = layui.laydate;

  //常规用法
  lay('.advanceDate').each(function(){
	laydate.render({
		elem: this
	});
	});

  //常规用法
  lay('.advanceTime').each(function(){
	laydate.render({
		elem: this,
		type: 'datetime'
	});
	});
  var layer = layui.layer
  ,laydate = layui.laydate
  ,table = layui.table;
  
  //日期
  laydate.render({
    elem: '#date'
  });
  //监听工具条
  table.on('tool(test3)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
    var data = obj.data //获得当前行数据
    ,layEvent = obj.event; //获得 lay-event 对应的值
    if(layEvent === 'detail'){
      layer.msg('查看操作');
    } else if(layEvent === 'del'){
      layer.confirm('真的删除行么', function(index){
        obj.del(); //删除对应行（tr）的DOM结构
        layer.close(index);
        //向服务端发送删除指令
      });
    } else if(layEvent === 'edit'){
      layer.msg('编辑操作');
    }
  });
  
});
function backList(){
	  window.location='/aps/productPlan.html';
}
// ]]>
</script>
        </div>
        <!--底部-->
        <div th:replace="fragments/footer :: footer"></div>
    </div>
</body>
</html>